home *** CD-ROM | disk | FTP | other *** search
- Path: jupiter.cc.gettysburg.edu!wilson
- From: "Michael L. Nicastro" <mnicastr@oberon.hs.gettysburg.edu>
- Newsgroups: comp.lang.c++
- Subject: Binary Converter
- Date: Tue, 02 Apr 1996 14:59:37 -0500
- Organization: Gettysburg College
- Message-ID: <31618729.6BC22935@oberon.hs.gettysburg.edu>
- NNTP-Posting-Host: oberon.hs.gettysburg.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i586)
-
- I am working on a binary converter function, and it isn't working
- correctly. I am basically passing a number to be converted to the
- function, then using if statements to see which place of the number
- would be in, dividing, and then doing the same with the remainder, until
- the ones place. Each time the number fits one of the if statements, it
- copies a one to a string, and for every if it does not fit, it copies a
- zero. Lastly it returns the converted binary number. Does anyone know a
- better way of doing this? Or why mine would not be working (I would
- include the source here, but I had some trouble, and had to reformat my
- drive, so it is gone as of now). If you can help, please email me at
- mnicastr@oberon.hs.gettysburg.edu
- Thanks
-